import java.util.Arrays;

public class ColorUtil {
    public static String[] chineseColor = {"黄色", "绿色", "红色", "黑色", "白色", "蓝色"};
    public static String[] englishColor = {"yellow", "green", "red", "black", "white", "blue"};


    public static String ChineseToEnglish(String color) {
//        if (color.equals("黄色")) {
//            return "yellow";
//        } else if (color.equals("绿色")) {
//            return "green";
//        }

        for (int i = 0; i < chineseColor.length; i++) {
            if (chineseColor[i].equals(color)) {
                return englishColor[i];
            }
        }
//        int index = Arrays.binarySearch(chineseColor, color);
//        System.out.println(index);
//        if (index != -1) {
//            return englishColor[index];
//        }
        return null;
    }

    public static String EnglishToChinese(String color) {
//        int index = Arrays.binarySearch(englishColor, color);
//        if (index != -1) {
//            return chineseColor[index];
//        }
        for (int i = 0; i < englishColor.length; i++) {
            if (englishColor[i].equals(color)) {
                return chineseColor[i];
            }
        }
        return null;
    }
}
